<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
    <script src="../vueJS/VUE.js"></script>
</head>

<body>
    <div id="root">
        <!-- 注意tab键要用keydown,因为放开会自动转移焦点 -->
        <input type="text" placeholder="按下回车输入" @keyup.enter = "showInfo">
    </div> 
    <script type="text/javascript">
    Vue.config.productionTip = false
    new Vue({
        el:'#root',
        methods:{
            showInfo(e){
                //if(e.keyCode!==13){return},正常需要判断是不是enter，但是vue可以直接指定@keyup.enter即摁下放开enter,可以连续写达到一起摁的效果@keyup.ctrl.y
                console.log(e.target.value)
            }
        }
    })
    </script>
</body>
</html>